﻿// ReSharper disable CppClangTidyModernizeUseNodiscard
#pragma once
#include "Material.h"
#include "Texture2D.h"
#include "Path.h"
#include "ShaderProgram.h"

class FLightMaterial final
	: public FMaterial
{
private:
public:

	virtual bool Init() override
	{
		InitShaderWayType = EInitShaderWayType::File;

		if (!FMaterial::Init())
		{
			return false;
		}

		Shader->SetLightingModel(ELightingModel::None);

		return true;
	}

	virtual void Use() override
	{
		FMaterial::Use();
	}

	std::filesystem::path GetVsSrcPath() const override
	{
		return FPath::BuildShaderPath("shader.vs");
	}

	std::filesystem::path GetFsSrcPath() const override
	{
		return FPath::BuildShaderPath("shader.fs");
	}

	const std::string& GetFsSrcCode() const override
	{
		static std::string CodeStr = R"(
			#version 410 core
			out vec4 FragColor;
			
			void main()
			{
				// 白色的光
			    FragColor = vec4(1.0); 
			}
		)";

		return CodeStr;
	}

	const std::string& GetVsSrcCode() const override
	{
		static std::string CodeStr = R"(

			#version 410 core 
			
			layout (location = 0) in vec3 aPos;
		
			uniform mat4 model;
			uniform mat4 view;
			uniform mat4 projection;
			
			void main()
			{
			    gl_Position = projection *  view * model * vec4(aPos, 1.0);
			}

		)";

		return CodeStr;
	}
};

